<template>
  <view>
    <block>
      <!-- #ifdef MP-WEIXIN -->
      <view class="" style="height: 100rpx"> </view>
      <!-- #endif -->
      <x-skeleton type="banner" :loading="true">
        <view>我是轮播图</view>
      </x-skeleton>
      <x-skeleton type="menu" :loading="true">
        <view>我是轮播图</view>
      </x-skeleton>
      <x-skeleton type="list" :loading="true">
        <view>我是轮播图</view>
      </x-skeleton>
      <x-skeleton
        type="waterfall"
        v-for="(item, index, key) in 100"
        :key="'waterfall' + index"
        :loading="true"
      >
        <view>我是轮播图</view>
      </x-skeleton>
    </block>
  </view>
</template>

<script>
import { getToken } from "../../utils/storage";
import { back } from "../../utils/wxAPI";

export default {
  data() {
    return {
      timerId: null,
    };
  },
  onLoad() {
    this.timerId = setInterval(() => {
      if (getToken()) {
        clearInterval(this.timerId);
        back();
      }
    }, 500);
  },
  methods: {},
  beforeDestroy() {
    // 清除定时器
    if (this.timerId) {
      clearInterval(this.timerId);
    }
  },
};
</script>
